class User {
  //public 类，子类，外部都可以访问
  // protected 类和子类可以访问
  //  private 子类也不可以访问，只有本类可以访问
  #host = "https://houdunren.com";
  constructor(name) {
    this.name = name;
    this.#check(name);
  }
  set host(url) {
    if (/^https?:/i.test(url)) {
      throw new Error("非法网址");
    }
    this.#host = url;
  }
  #check = () => {
    if (this.name.length < 5) {
      throw new Error("名字长度不能小于5位");
    }
  };
}
let hd = new User("后盾人的网址");
hd.host = "https://hdcms.com";
console.log(hd.host);
